Stub.exe

Most commercial installation programs consist of a compressed installation
executable appended to a stub program, resulting in some form of self-extracting
archive. The stub has the offset in the archive to the compressed data programmed
in. When it is run it writes a copy of the compressed data to disc, unpacks
it and then runs the actual installation routine. Finally it deletes whatever files
it created along the way.

I needed a simple installation program plus the ability to customise things exactly
as I wanted them, hence I decided to write my own. Though the actual installer
isn't included in this zip it is easy enough to write one of these yourself
using a property sheet with the files to install simply added as (custom) resources.
What is included here is the stub program. I have used Microsofts cab file
format for compression as it meant the decompressing code is available as
an API, further reducing the stub size (which is why I wrote it in assembler
in the first place). 

It is absolutely vital that you check the size of the assembled stub executable and
check that it matches the FILESIZE equ declared in Stub.inc. FILESIZE is the offset
to the compressed data. It is calculated as:

SizeOfAssembledProgram (Kb) * 1024

Once assembled, you create a self extracting archive by using the DOS Copy command.
I've included a .bat file (AppendCab.bat) to show how I went about doing this. The
/b switch is essential, telling Copy that the source and destination files are binary
files. Without this things simply won't work (the PE header won't be modified).

To create a cab file modify the Cab.DDF file included. This is a text file that
tells the MakeCab utility how to create the cab. There is a batch file for cab
creation included as well.

Have fun,
Andrew_K


